#http://122.235.240.91/pzgl/sys/peizhigl/list?xtxx=01&_search=false&rows=10000&page=1&sidx=QYRQ&sord=desc

import login

from urllib.error import URLError,HTTPError  
import urllib.parse  
import urllib.request
import re
import json
import os

directory = "D:\dev\Pzgl"

def getVersion():

    url = "http://%s/sys/peizhigl/list?xtxx=01&_search=false&rows=10000&page=1&sidx=QYRQ&sord=desc" % login.getIpAddress()
    
    try:  
        data = urllib.request.urlopen(url).read()
        strdata = str(data, encoding = "utf-8")

        #print(strdata)
        rst = json.loads(strdata)

        rows = rst["rows"]

        return rows

    except HTTPError as e:  
        print('Error code:',e.code)   
    except URLError as e:  
        print('Reason',e.reason)